<?php
$this->headLink()->appendStylesheet($this->baseUrl('widget/dataTable/css/dataTables.css'));
$this->headScript()->appendFile($this->baseUrl('widget/dataTable/js/jquery.dataTables.min.js'));
$this->headScript()->appendFile($this->baseUrl('widget/dataTable/js/initDataTables.js'));

//$this->placeholder("navegacion")->set($this->navegacion($this->nav));
$appConfig = Zend_Registry::get("appConfig");

//$perfil = App_Perfil::getInstance();
//$perfil->cargar("ACREDITAR_PROG_PREG");
//if (!$perfil->modificar()){
//    $this->form2->makeStatic();
//}

$domConfig = Zend_Registry::get('domConfig');
$this->placeholder( 'contenttab' )->captureStart();
echo $this->form;

if(count($this->publicaciones)>0):?>
<br/>
<table  width="95%" id="table_id" align="center" class="iceDatTbl zebra">
  <thead>
    <tr>
      <th width="40%">Publicación</th>
      <th width="35%">Tipo</th>
      <th width="15%">Fecha</th>
      <th width="10%">Acciones</th>
    </tr>
  </thead>
  <tbody>
	<?php foreach ($this->publicaciones as $value):
	    $fecha = new Zend_Date($value["fecha"]);
	?>
    <tr>
      <td><?php echo $value["nombrepublicacion"];?></td>
      <td><?php echo $domConfig->TIPO_PRODUCCION->$value["tipopublicacion"];?></td>
      <td><?php echo $fecha->toString($appConfig->fecha_formato_mostrar);?></td>
      <td>
	    <?php if (!$this->form->isStatic()) :
	        $params=App_Util_SafeUrl::encriptar(array("codpublicacion"=>$value["codpublicacion"],"coddocentevisita"=>$value["coddocentevisita"]),true); ?>
	    	<a href="<?=$this->baseUrl("/solicitudes/detalleautoevaluacion/publicaciondocente/{$params}");?>" title="Modificar" class="popup-big"><img src="<?=$this->baseUrl("/img/action_modify.gif");?>"/></a>
	    <?php endif; ?>
        <?php if (!$this->form->isStatic()) :
              $params=App_Util_SafeUrl::encriptar(array("coddocentevisita"=>$value["coddocentevisita"],
                                                        "codpublicacion"=>$value["codpublicacion"]),true); ?>
			  <a href="<?=$this->baseUrl("/solicitudes/detalleautoevaluacion/eliminarpublicaciondocente/{$params}");?>" title="" class="delete"><img src="<?=$this->baseUrl("img/action_delete.gif");?>" /></a>
		<?php endif; ?>
      </td>
    </tr>
  <?php  endforeach;?>
  </tbody>
</table>
	<script type="text/javascript">
	$(function() {
		var oTable = $('#table_id').dataTable({
			"bJQueryUI": true,
			"bAutoWidth": false,
			"oLanguage": { "sUrl": baseUrl + "/widget/dataTable/lang.es.txt" },
	 		"sPaginationType": "full_numbers",
	 		"bStateSave": true,
	 		"aoColumns": [
	 	 		 			null,
	 	 		 			null,
	 	 		 			null,
	 	 		 			{ "bSortable": false, "bSearchable": false }
	 	 		 		 ]
	 	 		  		
		});
		
		oTable.fnSetFilteringDelay();
		//oTable.fnCreateFilters([2]);
	
	});
	</script>
<br/>
<?php else:?>
<br/>
<?php echo $this->mensajes("No existen publicaciones registradas.");?>
<?php endif;


$this->placeholder( 'contenttab' )->captureEnd();
$this->tabs->agregar_contenido("Publicaciones", $this->placeholder( 'contenttab' ));
echo $this->tabs->renderElement();
?>
<script type="text/javascript">
function cerrar_recargar_padre(parametros){
	var ploc = self.opener.location;
	var pag_padre = ploc.protocol+"//"+ploc.host+ploc.pathname;
	if(parametros=="" || typeof(parametros)=="undefined") {
		ploc.href=ploc.href;
	}else {
		ploc.href=pag_padre+"?"+parametros;
	}
	window.close();
}
$(function() {
	$("#fecha").datepicker({'buttonImage': '<?= $this->baseUrl("img/calendar.png")?>'});
	var maxDate = $( "#fecha" ).datepicker( "option", "maxDate" );
	$( "#fecha" ).datepicker( "option", "maxDate", 'y m w' );
});
</script>